import request from '@/utils/http'

/**
 * 搜索题目
 */
export function apiSearchSubject(params: any) {
  return request.get({
    url: '/subject/search_subject',
    params
  })
}

/**
 * 添加题目
 */
export function apiAddSubject(params: any) {
  return request.post({
    url: '/subject/add_subject',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 编辑题目
 */
export function apiEditSubject(params: any) {
  return request.put({
    url: '/subject/edit_subject',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 获取题目详情
 */
export function apiGetSubject(params: any) {
  return request.get({
    url: '/subject/get_subject',
    params
  })
}

/**
 * 搜索题目扩展
 */
export function apiSearchSubjectExt(params: any) {
  return request.get({
    url: '/subject/search_subject_ext',
    params
  })
}

/**
 * 添加题目扩展
 */
export function apiAddSubjectExt(params: any) {
  return request.post({
    url: '/subject/add_subject_ext',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 编辑题目扩展
 */
export function apiEditSubjectExt(params: any) {
  return request.put({
    url: '/subject/edit_subject_ext',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 获取题目扩展详情
 */
export function apiGetSubjectExt(params: any) {
  return request.get({
    url: '/subject/get_subject_ext',
    params
  })
}

/**
 * 删除题目扩展
 */
export function apiDeleteSubjectExt(params: any) {
  return request.del({
    url: '/subject/delete_subject_ext',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 获取题目扩展列表
 */
export function apiGetSubjectBindExt(subjectId: number) {
  return request.get({
    url: '/subject/get_subject_bind_ext',
    params: {
      id: subjectId
    }
  })
}

/**
 * 添加题目扩展绑定
 */
export function apiBindSubjectExt(subjectId: number, subjectExtIds: string) {
  return request.post({
    url: '/subject/bind_subject_ext',
    params: {
      subjectId: subjectId,
      subjectExtIds: subjectExtIds
    },
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 删除题目扩展绑定
 */
export function apiDeleteSubjectExtBind(params: any) {
  return request.del({
    url: '/subject/delete_subject_ext_bind',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 更新题目扩展另见状态
 */
export function apiUpdateSubjectExtBindType(params: any) {
  return request.put({
    url: '/subject/update_subject_ext_bind_type',
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
